package cloud.example.eureka_client.controller;

import cloud.example.eureka_client.service.CountService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author zjm
 * @date 2018/12/22.
 */
@RestController
@RequestMapping("/lock")
@Slf4j
public class LockController {
  @Autowired
  private CountService countService;

  @GetMapping("/update")
  public String countIncreasement(@RequestParam Integer id) {
    Integer result = countService.count(id);
    log.info("complete count ,the number now is:{}", result);
    return result == null ? "failed" : "OK:" + result;

  }
}
